
exports.up = function(knex) {
    return knex.schema.createTable('batches', function(table) {
        table.increments().primary();

        table.tinyint('deleted')
            .defaultTo(0)
            .notNull()
            .unsigned();

        table.integer('good_id')
            .notNull()
            .unsigned()
            .comment('物品ID');

        table.integer('stock')
            .defaultTo(0)
            .notNull()
            .unsigned()
            .comment('入口数量');

        table.integer('used_stock')
            .defaultTo(0)
            .notNull()
            .unsigned()
            .comment('入口数量');

        table.integer('creator')
            .defaultTo(0)
            .notNull()
            .unsigned()
            .comment('入库人');

        table.double('price')
            .notNull()
            .unsigned()
            .comment('入库价格');

        table.timestamps();
    });
};

exports.down = function(knex) {
    return knex.schema.dropTableIfExists('batches');
};
